package baseFx.tests.common.config.apollo;

import baseFx.common.config.ConfigFactory;
import baseFx.common.config.MapConfig;
import baseFx.common.config.Name;
import baseFx.common.config.apollo.ApolloReader;

import java.util.Scanner;

public class TestApolloReader {
    public static void main(String[] args) {
        ConfigFactory.addReader(new ApolloReader("yhs", "http://192.168.10.106:8080/"));
        NotExists config = ConfigFactory.get(NotExists.class);
        Scanner scanner = new Scanner(System.in);
        String input;
        while (true) {
            input = scanner.nextLine();
            if ("0".equals(input)) {
                break;
            }
            System.out.println(config.a());
        }
        System.exit(0);
    }

    @Name("db")
    public interface DbConfig {
        String url();

        String user();

        String pwd();

        String a();

        String b();

        String c();
    }

    @Name("not.exists")
    public interface NotExists {
        String a();
    }

    @Name("remote.hosts")
    public interface RemoteHostConfig extends MapConfig {

    }

    @Name("cash_pay")
    public interface CashPayConfig {
        /**
         * 开发模式下代付结果是否成功
         */
        @Name("dev_mode_pay_result")
        default Boolean devModePayResult() {
            return true;
        }
    }
}
